import request from '@/config/axios'

export interface DatasourceVO {
  id: number
  datasourceName: string
  name: string
  age: number
  clinicalDiagnosisType: string
  germCellsVisible: boolean
  karyotype: string
  isGeneticFamily: boolean
  dataType: string
  isDataUploaded: boolean
  dataPath: string
  files: string
  dataSize: string
  cellRatios: string
  cellCount: number
  geneCount: number
  notes: string
  inputOrUpload: string
}

// 查询数据源列表
export const getDatasourcePage = async (params) => {
  return await request.get({ url: `/sca/datasource/page`, params })
}

// 查询数据源列表(无分页)
export const getDatasourceListNoPage = async () => {
  return await request.get({ url: `/sca/datasource/list-no-page` })
}

// 查询数据源详情
export const getDatasource = async (id: number) => {
  return await request.get({ url: `/sca/datasource/get?id=` + id })
}

// 新增数据源
export const createDatasource = async (data: DatasourceVO) => {
  return await request.post({ url: `/sca/datasource/create`, data })
}

// 修改数据源
export const updateDatasource = async (data: DatasourceVO) => {
  return await request.put({ url: `/sca/datasource/update`, data })
}

// 删除数据源
export const deleteDatasource = async (id: number) => {
  return await request.delete({ url: `/sca/datasource/delete?id=` + id })
}

// 导出数据源 Excel
export const exportDatasource = async (params) => {
  return await request.download({ url: `/sca/datasource/export-excel`, params })
}

// 上传文件
export const uploadFile = async (params) => {
  return await request.upload({ url: `/sca/file/upload`, data: params })
}
